package com.zxy.ziems.server.device.modules.modbus;

import cn.hutool.extra.validation.ValidationUtil;
import com.zxy.ziems.common.pojo.modbus.DevicePropertyConfigModbus;
import com.zxy.ziems.common.pojo.collector.GenericConfig;
import com.zxy.ziems.server.device.pojo.entity.DevicePropertyEntity;
import com.zxy.ziems.server.device.modules.DevicePropertyProcessor;
import org.springframework.stereotype.Service;

/**
 * @author 10348359
 * @create 2024-03-25 22:04
 */
@Service
public class DevicePropertyConfigModbusProcessor implements DevicePropertyProcessor<DevicePropertyConfigModbus, DevicePropertyConfigModbus> {
    @Override
    public String supportProtocol() {
        return "ModbusTcp";
    }

    @Override
    public void doBeforeEncodeAdvancedConfigActionTrigger(DevicePropertyConfigModbus config,
                                                          String protocol,
                                                          String deviceId,
                                                          String dataTypeId) {
        ValidationUtil.validate(config);
    }

    @Override
    public DevicePropertyConfigModbus doDecodeAdvancedConfig(DevicePropertyConfigModbus config,
                                                             String protocol,
                                                             String deviceId,
                                                             String dataTypeId) {
        return config;
    }
}
